<?php
/*
# ------------------------------------------------------------------------
# JD Base Theme
# ------------------------------------------------------------------------
# Copyright (C) 2004-2010 JoomlArt.com. All Rights Reserved.
# @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
# Author: JoomlArt.com
# Websites: http://www.joomlart.com - http://www.joomlancers.com.
# ------------------------------------------------------------------------
*/
$form [] = array ('#value' => '<div id="theme-profiles">' );

$html = '';

if (! $_COOKIE ['theme-profiles-t3-help']) {
	$help_style = "style=\"display:block\"";
} else {
	$help_style = "style=\"display:none\"";
}

$html .= '<div id="theme-profiles-t3-help" class="ja-inner-help" ' . $help_style . '>';

$html .= '<a title="' . t ( 'Hide' ) . '" class="ja-help-close" href="javascript:void(0)" onclick="t3_close_help(this, true)">' . t ( 'Close' ) . '</a>';
$html .= t ( '<strong>What are profiles?</strong><br />T3 Framework provide profiles to hold the settings of the template. You can see the default profiles just above this help. <br />Click any of these profiles to <em style="color:green">clone</em> / <em style="color:blue">rename & customize</em> / <em style="color:red">delete</em> existing profiles.<br /><br /><strong>Profile settings</strong><br />You can customize the default profile to use your favorite settings, but each other profile can override any of these settings. The profile settings control the template logo, font-size, layout, menu system and generally all template features.<br /><a target="_blank" href="http://wiki.joomlart.com/wiki/JD_T3_Framework/Guides#Profiles_Panel">Click here</a> to learn more about profiles and their settings.<br /><br /><span style="font-weight:bold; font-size:11px; color:white; background:orange; padding: 0 2px;">TIP</span> hover each of the parameter title to see usage instructions.' );
$html .= '</div>';

$form [] = array ('#value' => $html );
/*General Setting*/
$form ['jd_general_settings'] = array ('#type' => 'fieldset', '#title' => t ( 'General Settings' ), '#collapsible' => TRUE, '#collapsed' => TRUE );

//font-size


$options = array ('1' => 1, '2' => 2, '3' => 3, '4' => 4, '5' => 5, '6' => 6 );

$form ['jd_general_settings'] ['setting_font'] = array ('#type' => 'select', '#title' => t ( 'Font size' ), '#description' => t ( 'Select the font size for your front-end.<br /><br /><strong>Small</strong>: 1 is for 10px, 2 is for 11px<br /><strong>Medium</strong>: 3 is for 12px, 4 is for 13px<br /><strong>Large</strong>: 5 is for 14px, 6 is for 15px<br /><br />The default value is 3.' ), '#default_value' => $c_profile ['setting_font'] ? $c_profile ['setting_font'] : 3, '#options' => $options );

$options = array ('auto' => t ( 'Fluid' ), 'wide' => t ( 'Wide' ), 'narrow' => t ( 'Narrow' ), 'fixed' => t ( 'Specified' ) );
$form ['jd_general_settings'] ['setting_screen'] = array ('#type' => 'select', '#title' => t ( 'Theme width' ), '#description' => t ( 'Select one of various width options.<br /><br /> AUTO=This is auto adjusted based on user screen resolution.<p>Narrow Screen=750px</p><p>Wide Screen=950px</p><p>Specified Percentage=<strong>fluid</strong></p><p>Specified Pixels=<strong>fixed</strong></p>' ), '#default_value' => $c_profile ['setting_screen'] ? $c_profile ['setting_screen'] : 'wide', '#options' => $options );

$form ['jd_general_settings'] ['setting_specialwidth'] = array ('#type' => 'textfield', '#title' => t ( 'Special width' ), '#description' => t ( 'Enter here a value according to the above setting:<br />* if <em>SPECIFIED PIXEL</em> is selected, enter a value between 700 and 980<br />* if <em>SPECIFIED PERCENTAGE</em> is selected, enter a value between 60 and 100' ), '#default_value' => $c_profile ['setting_specialwidth'] );

$t3_logo_opts = array('t3-logo t3-logo-light'=>t('Light Logo'), 't3-logo t3-logo-dark'=>t('Dark Logo'),'t3-logo-sm t3-logo-light-sm'=>t('Light Logo Small'), 't3-logo-sm t3-logo-dark-sm'=>t('Dark Logo Small'),'none'=>t('Not Show')) ;
$form ['jd_general_settings'] ['setting_t3_logo'] = array (
	'#type' => 'select', 
	'#title' => t ( 'T3 Logo' ), 
	'#options'=> $t3_logo_opts,
	'#description' => t ( 'Choose T3 Logo style or disable t3 logo.' ),
	'#default_value' => $c_profile ['t3_logo'] 
);

if ($gfont_enable = 1) {
	$gfonts = array ('Cantarell' => 'Cantarell', 'Cardo' => 'Cardo', 'Crimson' => 'Crimson', 'Droid Sans' => 'Droid Sans', 'Droid Sans Mono' => 'Droid Sans Mono', 'Droid Serif' => 'Droid Serif', 'IM Fell' => 'IM Fell', 'Inconsolata' => 'Inconsolata', 'Josefin Sans Std Light' => 'Josefin Sans Std Light', 'Lobster' => 'Lobster', 'Molengo' => 'Molengo', 'Nobile' => 'Nobile', 'OFL Sorts Mill Goudy TT' => 'OFL Sorts Mill Goudy TT', 'Old Standard TT' => 'Old Standard TT', 'Reenie Beanie' => 'Reenie Beanie', 'Tangerine' => 'Tangerine', 'Vollkorn' => 'Vollkorn', 'Yanone Kaffeesatz' => 'Yanone Kaffeesatz' );
	$fonts = str_replace ( ' ', '+', implode ( '|', $gfonts ) );
	$gattrs = array ('rel' => 'stylesheet', 'type' => 'text/css', 'href' => 'http://code.google.com/webfonts/css?kit=fRn5xRji3KlvfYTK4F2Aig', 'media' => 'all' );
	drupal_add_link ( $gattrs );
	
	drupal_add_js ( $t3_base_theme_path . '/js/admin/gfont.js' );
	$form ['gfonts'] = array ('#type' => 'fieldset', '#title' => t ( 'Google Font API Settings' ), '#collapsible' => TRUE, '#collapsed' => TRUE );
	
	$array_suffix = array ();
	
	$elements = array ('global', 'logo', 'slogan', 'blocktitle', 'pageheading', 'nodeheading', 'mainnav' );
	foreach ( $elements as $elm ) {
		$suffix = "<div class=\"gfont-custom\" id=\"div-gfont-$elm\"><input type=\"checkbox\" id=\"$elm.extra\" name=\"$elm.extra\" onclick=\"t3_gfont_custombox('$elm');\" \" />\n";
		$suffix .= "<label for=\"$elm.extra\" class=\"editlinktip hasTip\" ><span class=\"ja-tooltip \" title=\"" . t ( 'Custom CSS: - Type your custom CSS here if you wish to override css in css files of the template.<br/>Please note that not all Google fonts support full font variation. Some font may not have BOLD, ITALIC or UPPERCASE variations. The most common used css overrides are FONT-SIZE, FONT-COLOR.<br/>Eg:<div class=\'code\'>font-size: 18px;<br/>color: #CCC;</div> ' ) . "\">" . t ( 'Custom CSS' ) . "</span></label>";
		//textarea, the extra property - hide by default. show when extra field is checked
		$suffix .= "<textarea id=\"$elm-style\" cols=\"40\" rows=\"5\" name=\"gfont_$elm.style\" class=\"clearfix\" style=\"display:none; margin-top: 5px; clear: both; \"></textarea></div>\n";
		$array_suffix [$elm] = $suffix;
	}
	
	$form ['gfonts'] ['gfont_global'] = array ('#type' => 'select', '#title' => t ( 'Global' ), '#description' => t ( 'This setting allows you to set a special font for all text content in your front-end.' ), '#default_value' => $c_profile ['gfont_global'], '#options' => array_merge ( array ('-1' => t ( '--Not applied--' ) ), $gfonts ), '#suffix' => $array_suffix ['global'] );
	
	$form ['gfonts'] ['gfont_logo'] = array ('#type' => 'select', '#title' => t ( 'Logo' ), '#description' => t ( 'This setting allows you to set a special font for the <i>Logo Text</i> in the <b>General Settings</b>.' ), '#default_value' => $c_profile ['gfont_logo'], '#options' => array_merge ( array ('-1' => t ( '--Select if logo is text--' ) ), $gfonts ), '#suffix' => $array_suffix ['logo'] );
	
	$form ['gfonts'] ['gfont_slogan'] = array ('#type' => 'select', '#title' => t ( 'Slogan' ), '#description' => t ( 'This setting allows you to set a special font for Sologan.' ), '#default_value' => $c_profile ['gfont_slogan'], '#options' => array_merge ( array ('-1' => t ( '--Select if slogan is text--' ) ), $gfonts ), '#suffix' => $array_suffix ['slogan'] );
	
	$form ['gfonts'] ['gfont_blocktitle'] = array ('#type' => 'select', '#title' => t ( 'Block Title' ), '#description' => t ( 'This setting allows you to set a special font for block titles.' ), '#default_value' => $c_profile ['gfont_blocktitle'], '#options' => array_merge ( array ('-1' => t ( '--Not applied--' ) ), $gfonts ), '#suffix' => $array_suffix ['blocktitle'] );
	
	$form ['gfonts'] ['gfont_pageheading'] = array ('#type' => 'select', '#title' => t ( 'Page Heading' ), '#description' => t ( 'This setting allows you to set a special font for your content pages in front-end.' ), '#default_value' => $c_profile ['gfont_pageheading'], '#options' => array_merge ( array ('-1' => t ( '--Not applied--' ) ), $gfonts ), '#suffix' => $array_suffix ['pageheading'] );
	
	$form ['gfonts'] ['gfont_nodeheading'] = array ('#type' => 'select', '#title' => t ( 'Node Heading' ), '#description' => t ( 'This setting allows you to set a special font for all node titles' ), '#default_value' => $c_profile ['gfont_nodeheading'], '#options' => array_merge ( array ('-1' => t ( '--Not applied--' ) ), $gfonts ), '#suffix' => $array_suffix ['nodeheading'] );
	
	$form ['gfonts'] ['gfont_mainnav'] = array ('#type' => 'select', '#title' => t ( 'Main Navigation' ), '#description' => t ( 'This setting allows you to set a special font for your main navigation.' ), '#default_value' => $c_profile ['gfont_mainnav'], '#options' => array_merge ( array ('-1' => t ( '--Not applied--' ) ), $gfonts ), '#suffix' => $array_suffix ['mainnav'] );
}

$form ['menu'] = array ('#type' => 'fieldset', '#title' => t ( 'Menu Settings' ), '#collapsible' => TRUE, '#collapsed' => TRUE );

$menus = $t3_setting->getMenus ();
$form ['menu'] ['menu'] = array ('#type' => 'select', '#title' => t ( 'Menu Type' ), '#description' => t ( 'Select from various available menu systems supported by JD T3 Blank. <p>Check the resources links provided on top of this panel.' ), '#default_value' => $c_profile ['menu'], '#options' => $menus );

//here pre load all of menu paramar config


$menu_styles = $t3_setting->getMenuStyles ();
$form ['menu'] ['menu_style'] = array ('#type' => 'select', '#title' => t ( 'Menu System' ), '#description' => t ( 'Select one of the available menu systems. If you want to use JD Mega Menu, you will have below some additional parameters and you need to read the user guide, the documentation link is given in left side of this page.' ), '#default_value' => $c_profile ['menu_style'], '#options' => $menu_styles );

$animations = array ();
$animations ['jswing'] = 'jswing';

$animations ['easeInQuad'] = 'easeInQuad';
$animations ['easeOutQuad'] = 'easeOutQuad';
$animations ['easeInOutQuad'] = 'easeInOutQuad';

$animations ['easeInCubic'] = 'easeInCubic';
$animations ['easeOutCubic'] = 'easeOutCubic';
$animations ['easeInOutCubic'] = 'easeInOutCubic';

$animations ['easeInQuart'] = 'easeInQuart';
$animations ['easeOutQuart'] = 'easeOutQuart';
$animations ['easeInOutQuart'] = 'easeInOutQuart';

$animations ['easeInQuint'] = 'easeInQuint';
$animations ['easeOutQuint'] = 'easeOutQuint';
$animations ['easeInOutQuint'] = 'easeInOutQuint';

$animations ['easeInSine'] = 'easeInSine';
$animations ['easeOutSine'] = 'easeOutSine';
$animations ['easeInOutSine'] = 'easeInOutSine';

$animations ['easeInExpo'] = 'easeInExpo';
$animations ['easeOutExpo'] = 'easeOutExpo';
$animations ['easeInOutExpo'] = 'easeInOutExpo';

$animations ['easeInCirc'] = 'easeInCirc';
$animations ['easeOutCirc'] = 'easeOutCirc';
$animations ['easeInOutCirc'] = 'easeInOutCirc';

$animations ['easeInElastic'] = 'easeInElastic';
$animations ['easeOutElastic'] = 'easeOutElastic';
$animations ['easeInOutElastic'] = 'easeInOutElastic';

$animations ['easeInBack'] = 'easeInBack';
$animations ['easeOutBack'] = 'easeOutBack';
$animations ['easeInOutBack'] = 'easeInOutBack';

$animations ['easeInBounce'] = 'easeInBounce';
$animations ['easeOutBounce'] = 'easeOutBounce';
$animations ['easeInOutBounce'] = 'easeInOutBounce';

$form ['menu'] ['menu_effectin'] = array ('#type' => 'select', '#title' => t ( 'Effect In' ), '#options' => $animations, '#description' => t ( '<p class="message"><span class="icon">&nbsp;</span>Apply for the Mega Menu only.</p>Select an effect for showing menus.' ) );

$form ['menu'] ['menu_effectout'] = array ('#type' => 'select', '#title' => t ( 'Effect Out' ), '#options' => $animations, '#description' => t ( '<p class="message"><span class="icon">&nbsp;</span>Apply for the Mega Menu only.</p>Select an effect for hidding menus.' ) );

$form ['menu'] ['menu_durationin'] = array ('#type' => 'textfield', '#title' => t ( 'Duration In' ), '#description' => t ( '<p class="message"><span class="icon">&nbsp;</span>Apply for the Mega Menu only.</p>Set the duration in miliseconds for showing menus.' ) );

$form ['menu'] ['menu_durationout'] = array ('#type' => 'textfield', '#title' => t ( 'Duration Out' ), '#description' => t ( '<p class="message"><span class="icon">&nbsp;</span>Apply for the Mega Menu only.</p>Set the duration in miliseconds for hidding menus.' ) );

$form ['menu'] ['menu_delay'] = array ('#type' => 'textfield', '#title' => t ( 'Delay' ), '#description' => t ( '<p class="message"><span class="icon">&nbsp;</span>Apply for the Mega Menu only.</p>Set the time in miliseconds for hidding all menus when mouse out the Main navigation.' ) );
//Theme settings
$form ['theme'] = array ('#type' => 'fieldset', '#title' => t ( 'Theme Settings' ), '#collapsible' => TRUE, '#collapsed' => TRUE );

//Theme settings
$themes = $t3_setting->getThemes ();

$theme_js = "var t3_themes = " . drupal_to_js ( $themes ['theme'] ) . ";\n";
drupal_add_js ( $theme_js, 'inline' );

$c_themes = explode ( ',', $c_profile ['themes'] );

$c_themes = t3_trim_array ( $c_themes );

if (! count ( $c_themes ))
	$c_themes = array ('default' );

$html = '<div class="form-item jd-subtheme-list">
		 <label>' . t ( 'Themes' ) . '</label>
		 <span id="jd-edit-sub-theme">&nbsp;</span>
     <div id="selected-themes" class="theme-sortable">
     ';

foreach ( $c_themes as $name ) {
	$html .= '<span id="' . $name . '">' . $name . '</span>';
}

$html .= '</div>
		<span class="sub-theme-default">default</span>
		';

$html .= '<div class="description">';
$html .= t ( 'Color theme to be used as default for your website. You can manage these themes in the <b>Themes</b> panel, but in this panel you can select the theme to be used for each profile.' );
$html .= '</div>';
$html .= '</div>';

$form ['theme'] ['theme'] = array ('#value' => $html );

//layouts
$form ['layouts'] = array ('#type' => 'fieldset', '#title' => t ( 'Layouts Settings' ), '#collapsible' => TRUE, '#collapsed' => TRUE );
$layouts = $t3_setting->getLayouts ();

$layouts_options = array ();
$handheld_options = array ();

$handheld_options [- 1] = t ( 'Disabled' );
foreach ( $layouts as $name => $layout_info ) {
	$layouts_options [$name] = $name;
	$handheld_options [$name] = $name;
}

$form ['layouts'] ['layout_desktop'] = array ('#type' => 'select', '#title' => t ( 'Desktop Layout' ), '#description' => t ( 'This template supports various layout options. Check the options from dropdown.' ), '#default_value' => $c_profile ['layout_desktop'], '#options' => $layouts_options );
$form ['layouts'] ['layout_handheld'] = array ('#type' => 'select', '#title' => t ( 'Handheld Layout' ), '#description' => t ( 'Select the layout to be used as the default layout for handheld devices,  by default is set to <b>handheld</b>. You can use a regular layout or disable this feature.' ), '#default_value' => $c_profile ['layout_handheld'], '#options' => $handheld_options );

$form ['layouts'] ['layout_iphone'] = array ('#type' => 'select', '#title' => t ( 'Iphone Layout' ), '#description' => t ( 'Select the layout to be used as the default layout for iPhone devices, by default is set to <b>iphone</b>. You can use a regular layout or disable this feature.' ), '#default_value' => $c_profile ['layout_iphone'], '#options' => $handheld_options );

//Add class suffix attribute for modules
//Need to add all block here
$blocks = $t3_setting->getBlocks ( $c_profile ['block'] );
$form ['block_class_suffix'] = array ('#type' => 'fieldset', '#title' => t ( 'Block Class Suffix' ), '#description' => t ( 'Block class suffix.' ), '#collapsible' => TRUE, '#collapsed' => TRUE );

ob_start ();

include ('block_suffix.php');
$html = ob_get_contents ();

ob_end_clean ();
//$html = 'Need to redo this';
$form ['block_class_suffix'] [] = array ('#value' => $html );

/* general options */
$form ['jd_general_options'] = array ('#type' => 'fieldset', '#title' => t ( 'User Tools' ), '#collapsible' => TRUE, '#collapsed' => TRUE );

$form ['jd_general_options'] ['option_font'] = array ('#type' => 'checkbox', '#title' => t ( 'Show Font Tools' ), '#description' => t ( 'Option to <em>show</em> or <em>hide</em> the font switcher tool.' ), '#default_value' => $c_profile ['option_font'] );

$form ['jd_general_options'] ['option_screen'] = array ('#type' => 'checkbox', '#title' => t ( 'Show Screen Tools' ), '#description' => t ( 'Option to <em>show</em> or <em>hide</em> the screen size switcher tool.' ), '#default_value' => $c_profile ['option_screen'] );

$form ['jd_general_options'] ['option_profiles'] = array ('#type' => 'checkbox', '#title' => t ( 'Show Profiles Tools' ), '#description' => t ( 'Option to <em>show</em> or <em>hide</em> the Profiles switcher tool.' ), '#default_value' => $c_profile ['option_profiles'] );

$form ['jd_general_options'] ['option_layouts'] = array ('#type' => 'checkbox', '#title' => t ( 'Show Layout Tools' ), '#description' => t ( 'Option to <em>show</em> or <em>hide</em> the layout switcher tool.' ), '#return_value' => 1, '#default_value' => $c_profile ['option_layouts'] );

$form ['jd_general_options'] ['option_menu'] = array ('#type' => 'checkbox', '#title' => t ( 'Show Menu Tools' ), '#description' => t ( 'Option to <em>show</em> or <em>hide</em> the menu system switcher tool.' ), '#return_value' => 1, '#default_value' => $c_profile ['option_menu'] );

$form ['profile_name'] = array ('#type' => 'hidden', '#value' => $c_profile ['name'] );

$form ['themes'] = array ('#type' => 'hidden', '#value' => $c_profile ['themes'] );

$form [] = array ('#value' => '</div>' );